*******************************************************
* Lyle 05 Jan 11: 						              *
*	-this program serves as a base shell for all	  *
*	 stata do files					                  *
*******************************************************


********************************
* Standard Stata Configuration *
********************************
clear all
set mem 999m
capture log close
set logtype text
cap cd "C:\Users\ejm5\Google Drive\2016_Research\Unemployment_MILEX"
cap cd "C:\Users\Jordan.Becker\Desktop\GD\2016_Research\Unemployment_MILEX"
cap cd "\\usnatonetapp01.eur.state.sbu\profiles\beckerjm\Desktop\2016_Research\Unemployment_MILEX"
log using "log\correlates_table7.log", replace


*********************
* Prepare Variables *
*********************
use "dta\2016_02_09_uem", clear
sort ccode year
xtset ccode year


********************
* Analyze the Data *
********************
set more off
sort ccode year
xtset ccode year


*TABLE 2: IV Analysis of Exclusion Mechanisms*
#delimit;
*1 Full Sample OLS*
#delimit;
xi:xtpcse milburden l.ln_usa_milex i.ccode if ccode!=2, pairwise;
outreg2 using output\Correlates_Table7, bdec(3) tdec(3) e(rmse) replace;
*2 Flexible Response & Post-GWOT OLS*
#delimit;
xi:xtpcse milburden l.ln_usa_milex i.ccode if ccode!=2& sandler_strategic==1, pairwise;
outreg2 using output\Correlates_Table7, bdec(3) tdec(3) e(rmse);
*3 MAD & GWOT OLS*
#delimit;
xi:xtpcse milburden l.ln_usa_milex i.ccode if ccode!=2& sandler_strategic==0, pairwise;
outreg2 using output\Correlates_Table7, bdec(3) tdec(3) e(rmse);

*4 First Stage For U.S. Milex (war infrastructure_gdp)*
#delimit;
xi:xtreg ln_usa_milex usa_war_infrastructure i.ccode if ccode!=2, robust cluster(ccode);
outreg2 using output\Correlates_Table7, bdec(3) tdec(3) e(rmse);
*5 2SLS for Milburden, Full Sample*
#delimit;
xi:xtivreg2 milburden (l.ln_usa_milex=l.usa_war_infrastructure) if ccode!=2, first fe robust cluster(ccode);
outreg2 using output\Correlates_Table7, bdec(3) tdec(3) e(rmse);
*6 2SLS for Milburden, 1949-1966*
#delimit;
xi:xtivreg2 milburden (l.ln_usa_milex=l.usa_war_infrastructure) if ccode!=2&year<1967, first fe robust cluster(ccode);
outreg2 using output\Correlates_Table7, bdec(3) tdec(3) e(rmse);
*7 2SLS for Milburden, 1967-2001*
#delimit;
xi:xtivreg2 milburden (l.ln_usa_milex=l.usa_war_infrastructure) if ccode!=2&year>=1967 & year<=2001, first fe robust cluster(ccode);
outreg2 using output\Correlates_Table7, bdec(3) tdec(3) e(rmse);
*8 2SLS for Milburden, 2002-2008*
#delimit;
xi:xtivreg2 milburden (l.ln_usa_milex=l.usa_war_infrastructure) if ccode!=2&year>=2002 & year<=2008, first fe robust cluster(ccode);
outreg2 using output\Correlates_Table7, bdec(3) tdec(3) e(rmse);
*9 2SLS for Milburden, 2008-2016*
#delimit;
xi:xtivreg2 milburden (l.ln_usa_milex=l.usa_war_infrastructure) if ccode!=2&year>=2009, first fe robust cluster(ccode);
outreg2 using output\Correlates_Table7, bdec(3) tdec(3) e(rmse);



*10 2SLS for personnel_gdp, Full Sample*
#delimit;
xi:xtivreg2 personnel_gdp (l.ln_usa_milex=l.usa_war_infrastructure) if ccode!=2, first fe robust cluster(ccode);
outreg2 using output\Correlates_Table7, bdec(3) tdec(3) e(rmse);
*11 2SLS for personnel_gdp, 1967-2001*
#delimit;
xi:xtivreg2 personnel_gdp (l.ln_usa_milex=l.usa_war_infrastructure) if ccode!=2&year>=1967 & year<=2001, first fe robust cluster(ccode);
outreg2 using output\Correlates_Table7, bdec(3) tdec(3) e(rmse);
*12 2SLS for personnel_gdp, 2002-2008*
#delimit;
xi:xtivreg2 personnel_gdp (l.ln_usa_milex=l.usa_war_infrastructure) if ccode!=2&year>=2002 & year<=2008, first fe robust cluster(ccode);
outreg2 using output\Correlates_Table7, bdec(3) tdec(3) e(rmse);
*13 2SLS for personnel_gdp, 2009-2016*
#delimit;
xi:xtivreg2 personnel_gdp (l.ln_usa_milex=l.usa_war_infrastructure) if ccode!=2&year>=2009, first fe robust cluster(ccode);
outreg2 using output\Correlates_Table7, bdec(3) tdec(3) e(rmse);


*14 2SLS for equipment_gdp, Full Sample*
#delimit;
xi:xtivreg2 equipment_gdp (l.ln_usa_milex=l.usa_war_infrastructure) if ccode!=2, first fe robust cluster(ccode);
outreg2 using output\Correlates_Table7, bdec(3) tdec(3) e(rmse);
*15 2SLS for equipment_gdp, 1967-2001*
#delimit;
xi:xtivreg2 equipment_gdp (l.ln_usa_milex=l.usa_war_infrastructure) if ccode!=2&year>=1967 & year<=2001, first fe robust cluster(ccode);
outreg2 using output\Correlates_Table7, bdec(3) tdec(3) e(rmse);
*16 2SLS for equipment_gdp, 2002-2008*
#delimit;
xi:xtivreg2 equipment_gdp (l.ln_usa_milex=l.usa_war_infrastructure) if ccode!=2&year>=2002 & year<=2008, first fe robust cluster(ccode);
outreg2 using output\Correlates_Table7, bdec(3) tdec(3) e(rmse);
*17 2SLS for equipment_gdp, 2009-2016*
#delimit;
xi:xtivreg2 equipment_gdp (l.ln_usa_milex=l.usa_war_infrastructure) if ccode!=2&year>=2009, first fe robust cluster(ccode);
outreg2 using output\Correlates_Table7, bdec(3) tdec(3) e(rmse);

*18 2SLS for operating_gdp, Full Sample*
#delimit;
xi:xtivreg2 operating_gdp (l.ln_usa_milex=l.usa_infrastructure) if ccode!=2, first fe robust cluster(ccode);
outreg2 using output\Correlates_Table7, bdec(3) tdec(3) e(rmse);
*19 2SLS for operating_gdp, 1985-2001*
#delimit;
xi:xtivreg2 operating_gdp (l.ln_usa_milex=l.usa_infrastructure) if ccode!=2&year>=1985 & year<=2001, first fe robust cluster(ccode);
outreg2 using output\Correlates_Table7, bdec(3) tdec(3) e(rmse);
*20 2SLS for operating_gdp, 2002-2008*
#delimit;
xi:xtivreg2 operating_gdp (l.ln_usa_milex=l.usa_infrastructure) if ccode!=2&year>=2002 & year<=2008, first fe robust cluster(ccode);
outreg2 using output\Correlates_Table7, bdec(3) tdec(3) e(rmse);
*21 2SLS for operating_gdp, 2009-2016*
#delimit;
xi:xtivreg2 operating_gdp (l.ln_usa_milex=l.usa_infrastructure) if ccode!=2&year>=2009, first fe robust cluster(ccode);
outreg2 using output\Correlates_Table7, bdec(3) tdec(3) e(rmse);

*22 2SLS for infrastructure_gdp, Full Sample*
#delimit;
xi:xtivreg2 infrastructure_gdp (l.ln_usa_milex=l.usa_infrastructure) if ccode!=2, first fe robust cluster(ccode);
outreg2 using output\Correlates_Table7, bdec(3) tdec(3) e(rmse);
*23 2SLS for infrastructure_gdp, 1985-2001*
#delimit;
xi:xtivreg2 infrastructure_gdp (l.ln_usa_milex=l.usa_infrastructure) if ccode!=2&year>=1985 & year<=2001, first fe robust cluster(ccode);
outreg2 using output\Correlates_Table7, bdec(3) tdec(3) e(rmse);
*24 2SLS for infrastructure_gdp, 2002-2008*
#delimit;
xi:xtivreg2 infrastructure_gdp (l.ln_usa_milex=l.usa_infrastructure) if ccode!=2&year>=2002 & year<=2008, first fe robust cluster(ccode);
outreg2 using output\Correlates_Table7, bdec(3) tdec(3) e(rmse);
*25 2SLS for infrastructure_gdp, 2009-2016*
#delimit;
xi:xtivreg2 infrastructure_gdp (l.ln_usa_milex=l.usa_infrastructure) if ccode!=2&year>=2009, first fe robust cluster(ccode);
outreg2 using output\Correlates_Table7, bdec(3) tdec(3) e(rmse) excel;
